#pragma once

#include "SDL.h"
#include "SDL_image.h"
#include "GameStateMachine.h"
#include <Windows.h>
#include <ctime>
#include "PlayState.h"
#include "MenuState.h"

using namespace std;

class Game
{
public:

	static Game* Instance()
	{
		if (s_pInstance == 0)
		{
			s_pInstance = new Game();
			return s_pInstance;
		}
		return s_pInstance;
	}

	// Destructor
	~Game(){}

	//Game methods
	bool init(char* title, int xpos, int ypos, int width, int height, Uint32 flags);

	void handleEvents();
	void update();
	void render(); 
	void clean();
	void quit();

	void addCreep();// creat new creep

	float timeGenarateCreep; // time creat -> creep

	//GETs
	SDL_Renderer* getRenderer() const;
	GameStateMachine* getStateMachine() const;
	bool running() const;
	void getRunning(const int &a);

protected:
private:

	bool m_bAlive;

	bool m_running;
	//SINGLETON transformation
	Game();
	static Game* s_pInstance;

	//Atributs
	SDL_Window* m_pWindow; 
	SDL_Renderer* m_pRenderer; 
	GameStateMachine* m_pGameStateMachine;
	
};

typedef Game TheGame;